<uni-forms-item name="name" label="商户名称" required>
  <uni-easyinput placeholder="商户名称" v-model="formData.name" trim="both"></uni-easyinput>
</uni-forms-item>
<!-- 添加Logo上传 -->
<uni-forms-item name="logo" label="商户Logo">
  <view class="logo-preview" v-if="formData.logo && !newLogoSelected">
    <image :src="formData.logo" mode="aspectFit" style="width: 120px; height: 120px;"></image>
    <button @click="clearLogo" size="mini" type="warn" class="clear-btn">删除</button>
  </view>
  <uni-file-picker 
    v-model="logoFiles" 
    :value="logoFiles"
    file-mediatype="image"
    mode="grid"
    :auto-upload="true"
    limit="1"
    @select="selectLogo"
    @success="uploadSuccess"
    @fail="uploadFail"
  ></uni-file-picker>
</uni-forms-item>
<uni-forms-item name="phone" label="联系电话">
  <uni-easyinput placeholder="联系电话" v-model="formData.phone" trim="both"></uni-easyinput>
</uni-forms-item>
...(about 50 lines omitted)...
let formData = {
  "tenant_id": "",
  "name": "",
  "logo": "",
  "phone": "",
  "address": "",
  "status": 1,
...(about 25 lines omitted)...
return {
  formData,
  logoFiles: [], // 用于文件选择器显示
  newLogoSelected: false, // 标记是否选择了新Logo
  formOptions: {
    "status_localdata": [
...(about 25 lines omitted)...
  if (data) {
    this.formData = data
   
   // 处理Logo显示
   if (this.formData.logo) {
     console.log('商户已有Logo:', this.formData.logo)
   }
  }
...(about 15 lines omitted)...
}
},
methods: {
 // 图片选择事件
 selectLogo(e) {
   console.log('选择新文件：', e)
   this.newLogoSelected = true
 },
 
 // 上传成功
 uploadSuccess(e) {
   console.log('上传成功：', e)
   // 获取上传后的图片URL
   if (e.tempFilePaths && e.tempFilePaths.length > 0) {
     this.formData.logo = e.tempFilePaths[0]
   } else if (e.tempFiles && e.tempFiles.length > 0 && e.tempFiles[0].url) {
     this.formData.logo = e.tempFiles[0].url
   }
 },
 
 // 上传失败
 uploadFail(e) {
   console.error('上传失败：', e)
   uni.showToast({
     title: '图片上传失败',
     icon: 'none'
   })
 },
 
 // 清除已有Logo
 clearLogo() {
   this.formData.logo = ''
   this.newLogoSelected = false
 },
 
 /**
  * 验证表单并提交
  */
} 

<style>
.logo-preview {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.clear-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 12px;
  padding: 2px 8px;
}

.uni-file-picker {
  margin-top: 8px;
}
</style> 